<template>
    <view>
        <view class="pays-mask"></view>
        <view class="pays-popup pays-popup-middle ">
            <view class="pays-top">
                <view class="pays-top-title-box">
                    <image class="pays-top-title-img" src="../../static/ibs/img_comm_success.png" mode=""></image>
                    <text class="pays-top-title-text">支付成功</text>
                </view>
                <view class="pays-top-close-btn" @tap="close">
                    <image src="../../static/ibs/img_comm_close.png" mode=""></image>
                </view>
            </view>
            <view class="pays-box">
                <view class="pays-box-text-40">
                    采购意向价格: {{paySuccessInfo.intentPrice}}
                </view>
            </view>
            <view class="pays-box">
                <view class="pays-box-text-20">
                    买家联系方式: {{paySuccessInfo.contactMobileNo}}
                </view>
            </view>
            <view class="pays-box">
                <view class="pays-box-text-20">
                    要求: {{paySuccessInfo.remarkDemand}}
                </view>
            </view>
            <view class="pays-btn-box">
                <view class="pays-btn-box-bg">
                    <text @tap="call(paySuccessInfo)">电话联系买家</text>
                </view>
            </view>

        </view>


    </view>
</template>

<script>
    import validate from "@/common/graceChecker.js";
    import api from "@/common/api.js";

    export default {
        props: ['paySuccessInfo'],
        data() {
            return {
                listData: {}

            };
        },
        onLoad() {
            let that = this;
        },
        methods: {
            close() {
                this.$emit('closeInfo', 'paySuccessBox');
            },
            getData() {
                let that = this;
                console.log("调用微信支付成功返回数据-----------", that.demandInfo)
                var url = "/wechat/demand/demandInfo?demandId=" + that.demandInfo.id + "&&orderPayId=" + that.orderPayId;   //请求地址
                var params = {};
                api.httpRequest(url, params, "post",true).then((res) => {
                    that.listData = res.result;
                });
            },
            //联系买家
            call(data) {
                let that = this;
				var url = '/wechat/demand/callDemandOwner?demandId='+data.id;
				var params = {};
				api.httpRequest(url, params, "POST",true).then((res) => {  //电话联系接口
				   if(res.code==200){
						uni.makePhoneCall({
							phoneNumber: data.contactMobileNo,//调用电话号码
							success() {
								that.$parent.isShowpaySuccessBox = false
							}
						});
				   }else{
					    uni.showToast({
					       title: res.message,
					       icon: 'none',
					       duration: 2000
					    });
				   }
						
				});


            }

        }
    }
</script>
<style scoped="">
    .pays-mask {
        position: fixed;
        z-index: 998;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background-color: rgba(0, 0, 0, .5);
    }

    .pays-popup {
        position: absolute;
        z-index: 999;
        background-color: #ffffff;
        box-shadow: 0 0 30upx rgba(0, 0, 0, .1);
    }

    .pays-popup-middle {
        width: 560upx;
        height: 540upx;
        border-radius: 8upx;
        top: 50%;
        left: 50%;
        position: fixed;
        overflow: hidden;
        transform: translate(-50%, -50%);
    }

    .pays-top {
        height: 116upx;
        border: 1upx solid #E5E5E5;
        display: flex;
        justify-content: space-between;
    }

    .pays-top-close-btn {
        padding-right: 20upx;
        padding-top: 20upx;
        display: flex;
        justify-content: flex-end;
    }

    .pays-top-close-btn image {
        width: 36upx;
        height: 36upx;
    }

    .pays-top-title-box {
        padding-left: 40upx;
        padding-top: 35upx;
        display: flex;
        justify-content: flex-start;
    }

    .pays-top-title-img {
        width: 48upx;
        height: 48upx;
    }

    .pays-top-title-text {
        padding-left: 10upx;
        color: #077131;
        font-size: 34upx;
    }

    .pays-box {
        display: flex;

        font-size: 28upx;
        padding-left: 40upx;
        color: #1A1A1A;
    }

    .pays-box-text-20 {
        padding-top: 20upx;
    }

    .pays-box-text-40 {
        padding-top: 40upx;
    }

    .pays-btn-box {
        margin-top: 60upx;
        display: flex;
        justify-content: center;
        color: #FFFFFF;
        font-size: 34upx;
    }

    .pays-btn-box-bg {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 460upx;
        background: #077131;
        height: 88upx;
        line-height: 88upx;
        border-radius: 44upx;
        text-align: center;
    }

    .pays-btn-box-img {
        width: 36upx;
        height: 36upx;
        padding-right: 10upx;
    }


</style>
